/**   
* @Title: DynamicQuery.java
* @Package org.xaoyaoyao.cloud.jpa.dynamic
* @Description: TODO
* @author xaoyaoyao
* @date Feb 11, 2019 3:25:47 PM
* @version V1.0   
*/
package org.xaoyaoyao.cloud.jpa.dynamic;

import java.util.List;

/**
 * @ClassName: DynamicQuery
 * @Description: TODO
 * @author xaoyaoyao
 * @date Feb 11, 2019 3:25:47 PM
 * 
 */
public interface DynamicQuery {

	/**
	 * @Title: save
	 * @Description: 保存数据
	 * @param entity
	 * @return void
	 */
	void save(Object entity);

	/**
	 * @Title: update
	 * @Description: 更新全部数据
	 * @param entity
	 * @return void
	 */
	void update(Object entity);

	/**
	 * @Title: updateByPrimaryKey
	 * @Description: 根据PrimaryKey更新数据，对象中必须PrimaryKey必须非空，即实体类注解的时候必须要有@Id
	 * @param entity
	 * @return int
	 */
	int updateByPrimaryKey(Object entity);

	/**
	 * @Title: updateSelective
	 * @Description: 只更新非空数据
	 * @param entity
	 *            属性
	 * @param primaryKeyVal
	 *            主键值
	 * @return int
	 */
	int updateSelective(Object entity, Object primaryKeyVal);

	/**
	 * @Title: update
	 * @Description: 更新
	 * @param setEntity
	 * @param whereEntity
	 * @return int
	 */
	int update(Object setEntity, Object whereEntity);

	/**
	 * @Title: delete
	 * @Description: 根据id删除数据
	 * @param entityClass
	 * @param entityid
	 * @return void
	 */
	<T> void delete(Class<T> entityClass, Object entityid);

	/**
	 * @Title: delete
	 * @Description: 根据ids删除数据
	 * @param entityClass
	 * @param entityids
	 * @return void
	 */
	<T> void delete(Class<T> entityClass, Object[] entityids);

	/**
	 * @Title: nativeQueryList
	 * @Description: 查询数据
	 * @param nativeSql
	 * @param params
	 * @return List<T>
	 */
	<T> List<T> nativeQueryList(String nativeSql, Object... params);

	/**
	 * @Title: nativeQueryListMap
	 * @Description: 查询数据
	 * @param nativeSql
	 * @param params
	 * @return List<T>
	 */
	<T> List<T> nativeQueryListMap(String nativeSql, Object... params);

	/**
	 * @Title: nativeQueryListModel
	 * @Description: 查询数据
	 * @param resultClass
	 * @param nativeSql
	 * @param params
	 * @return List<T>
	 */
	<T> List<T> nativeQueryListModel(Class<T> resultClass, String nativeSql, Object... params);

	/**
	 * @Title: nativeQueryCount
	 * @Description: 求总数
	 * @param nativeSql
	 * @param params
	 * @return Long
	 */
	Long nativeQueryCount(String nativeSql, Object... params);

}
